package newsAction;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

import PO.NewsInfoPO;
import filmsDao.StudentDao;
import newsDao.NewsDao;

public class addNews extends ActionSupport {
	private int id;
	private String title;
	private String content;
	private String time;
	private String maker;

	private String message="input";

	

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getMaker() {
		return maker;
	}

	public void setMaker(String maker) {
		this.maker = maker;
	}

	public String execute() throws Exception {
		NewsDao dao = new NewsDao();
		boolean save = dao.saveNews(news());
		if (save) {
			message = "success";
		}
		return message;
	}

	private NewsInfoPO news() {
		NewsInfoPO info=new NewsInfoPO();
		System.out.println(
				this.getId()+this.getTitle()+this.getContent()+this.getTime()+this.getMaker()
				+ "");
		
		info.setId(this.getId());
		info.setTitle(this.getTitle());
		info.setContent(this.getContent());
		info.setTime(this.getTime());
		info.setMaker(this.getMaker());
		return info;

	}

}
